<%

option explicit

dim sSubmitted
dim nRequestNo
dim sMailTo
dim sDoResend

'dll call
dim dllDirResend
dim sDirResend
	

sSubmitted = Request.Form("sSubmitted")
nRequestNo = Request.QueryString("nReqNum")
sMailTo = Request.QueryString("sMailTo")

if sSubmitted = "true" then

	nRequestNo			= Request.Form("nRequestNo")
	sMailTo				= Request.Form("txtsMailTo")
	sDoResend			= Request.Form("chkResend")
	
	if sDoResend = "on" then
		set dllDirResend = Server.CreateObject("KeyTax.clsRequests")
			sDirResend = dllDirResend.ResendEmail(nRequestNo,sMailTo)

		if instr(UCASE(sDirResend), "SUCCESS") then
			sDirResend =  "The correspondence for request " & nRequestNo & " will be sent to your email address (" & sMailTo & ")"
		end if
	end if
end if

%>


<HTML>

<link rel="stylesheet" type="text/css" href="../../stylesheets/keytaxv2.css">
<BODY topmargin=0 leftmargin=0>

<form name="frmResendDirective" action="dir_resend.asp" method="post">

<table width=102% cellpadding=2 cellspacing=1 height=90 bgcolor="#666666">
	<tr>
		<td class="FormSectionHeading" colspan=2 valign=bottom>Email Correspondence</td>
	</tr>
	<tr>
		<td class="FormLeftCell">
			<center>
			<% if sDirResend <> "" then%>
				
				<font color=red><b><%=sDirResend%></font>
				
			<% else %>
			
			<table cellpadding=0 cellspacing=0>
				<tr>
					<td><input type="checkbox" name="chkResend"></td>
					<td>Resend the email correspondence for this request to my email address &nbsp;&nbsp</td>
					<td><input type="text" name="txtsMailTo" value="<%=sMailTo%>" style="width:350px"></td>
				</tr>
			</table>
			
			<% end if %>
			</center>
		</td>
	</tr>
	<tr>
		<td class="FormBottomBar" align=right>
			<input type=button name="btnDirResend" class="FormBottomButton" value="Submit" onclick="SubmitForm()">
		</td>
	</tr>
</table>

<input type=hidden name="sSubmitted" value="<%=sSubmitted%>">
<input type=hidden name="nRequestNo" value="<%=nRequestNo%>">
<input type=hidden name="sMailTo" value="<%=sMailTo%>">

</form>
</BODY>
</HTML>


<script language="vbscript">

sub SubmitForm()

	frmResendDirective.sSubmitted.value = "true"
	
	frmResendDirective.submit
	
end sub

</script>